package cn.com.hhrcw.utils;

import cn.com.hhrcw.entity.OpDeliveryHistory;
import org.springframework.util.CollectionUtils;

import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

/**
 * @program: recruit-boot-parent
 *
 * @author: JD
 * @create: 2020-11-03 14:47
 **/
public class QueryUtil {

    public final static String QUERY_EMPTY = " ";


    public static Map<Integer, Integer> getInfo(List<OpDeliveryHistory> histories) {
        Map<Integer, Integer> res = new LinkedHashMap<>();
        if (!CollectionUtils.isEmpty(histories)) {
            histories.forEach(e -> {
                if (e.getState() != null) {
                    Integer key = e.getState();
                    Integer value = res.get(key);
                    if (value == null) {
                        value = 0;
                    }
                    res.put(key, value + 1);
                }
            });
        }
        return res;
    }
}
